import re
n=eval(input())
sum_v=0
sum_e=0
for i in range(0,n):
    s=re.split('[{,}]',input())
    #print(s)
    for j in range(2,len(s)):
        if s[j]!='' and s[j]!=' ':
            sum_v+=1
            tmp=s[j][4:]
            tmp=int(tmp)
            sum_e+=tmp
print(n,sum_v,sum_e)

